package com.danli;

// 静态变量的方式
public class Singleton6 {


    private static Object object = new Object();
   private static Singleton6 singleton6 = null;

    private Singleton6(){}
    //提供一个公共的静态的方法 返回当前的对象
    public  static Singleton6 getInstance(){
        if(singleton6==null){
            // 1.
            synchronized(object) {
                singleton6 = new Singleton6();
            }
        }
        return singleton6;
    }
    
}


